<template>
  <div>
    <div ref="banner" class="banner" @click="handleGallaryClick">
      <img class="banner-img" src="//img1.qunarzz.com/sight/p0/1708/73/73cedba65c6e4e40a3.water.jpg_600x330_4ee28ff3.jpg">
      <div class="banner-info">
        <div class="banner-title">李小龙乐园</div>
        <div class="banner-num"><span class="iconfont banner-icon">&#xe679;</span>60</div>
      </div>
    </div>
    <fade-animation>
      <common-gallary :imgs="imgs" v-show="showGallary" @close="handleGallaryClose"></common-gallary>
    </fade-animation>
  </div>
</template>

<script>
import CommonGallary from 'common/gallary/Gallary'
import FadeAnimation from 'common/fade/Fade'
export default {
  name: 'DetailBanner',
  data () {
    return {
      showGallary: false,
      imgs: ['//img1.qunarzz.com/sight/p0/1603/3b/3bd311262ee06d8c90.img.jpg_600x330_cd2e3bf7.jpg', '//img1.qunarzz.com/sight/p0/1603/6a/6aa18b6abc19fedf90.img.jpg_600x330_dc9301a3.jpg']
    }
  },
  components: {
    CommonGallary,
    FadeAnimation
  },
  methods: {
    handleGallaryClick () {
      this.showGallary = true
    },
    handleGallaryClose () {
      this.showGallary = false
    }
  },
  activated () {
    this.$emit('getHeight', this.$refs.banner.offsetHeight)
  }
}
</script>

<style lang="stylus" scoped>
  .banner
    position: relative
    width 100%
    height 0
    overflow hidden
    padding-bottom 55%
    &:after
      content: ''
      display block
      position absolute
      left 0
      bottom 0
      right 0
      min-height .6rem
      background-color transparent
      background-image linear-gradient(to bottom,rgba(0,0,0,0),rgba(0,0,0,.8))
    .banner-img
      width 100%
    .banner-info
      position: absolute
      right .2rem
      bottom .36rem
      left .2rem
      min-height .4rem
      color #fff
      .banner-title
        font-size .36rem
        line-height .4rem
        text-shadow 0 1px 2px rgba(0,0,0,.7)
      .banner-num
        width 1.2rem
        height .4rem
        line-height .4rem
        position absolute
        left .2rem
        bottom .7rem
        background: rgba(0,0,0,.5)
        border-radius .2rem
        text-align center
        font-size .24rem
        .banner-icon
          font-size .24rem
          margin-right .1rem
</style>
